<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListWebserviceTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">

            <h:panelGroup id="messagePanel" styleClass="ajustaListaMensagemErro"  layout="block" >
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="list" />
            </h:panelGroup>

            <p:panel header="#{bundle.ListWebserviceTitle_grafico}" style="width: 100%">              

                <p:outputLabel value="Ano: "/>
                <p:selectOneMenu value="#{relatorioWebServiceController.ano}" id="ano">                        
                    <f:selectItems value="#{relatorioWebServiceController.itemsAnosGrafico}"/>
                    <p:ajax update=":formList:basic, :formList:panelInformativo" listener="#{relatorioWebServiceController.alteraAno()}" />
                </p:selectOneMenu>

                <hr/>

                <p:barChart id="basic" value="#{relatorioWebServiceController.empresasModel}" legendPosition="ne"
                            title="#{bundle.ListWebserviceTitle_webserviceProducao}" animate="true" 
                            datatipFormat="#{relatorioWebServiceController.datatipFormat}" showDatatip="true" min="0" max="250" 
                            style="height:300px; width: 100%" widgetVar="chart"/>

                <hr/>

                <p:commandButton type="button" value="#{bundle.WebserviceExportarComoImagemButton}" icon="ui-icon-extlink" onclick="exportaGrafico();"/>  

                <p:dialog id="dialogImg" widgetVar="dlg" showEffect="fade" resizable="false" dynamic="true" maximizable="false"  modal="true" header="#{bundle.ListWebserviceTitle_imagemGrafico}">  
                    <p:outputPanel id="output" layout="block" style="width:99%;height:300px"/>  
                    <p:tooltip value="#{bundle.ListWebserviceTitle_tooltipImagem}" for="output" />
                </p:dialog> 

                <script>
                    function exportaGrafico() {
                        $('#formList\\:output').empty().append(chart.exportAsImage());
                        dlg.show();
                    }
                </script>
                <br/><br/>

                <h:panelGrid columns="2">
                    <p:panel id="panelInformativo" header="#{bundle.ListWebserviceTitle_quantitativoAnual} - #{relatorioWebServiceController.ano}" style="width: 400px">
                        <h:panelGrid columns="2" >

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_empresasTransmDados}" />
                            <h:outputText value="#{relatorioWebServiceController.qtdEmpresasOperandoWebService}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_estacoesFLUTransmDados}" />
                            <h:outputText  value="#{relatorioWebServiceController.estacoesFLU}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_estacoesPLUTransmDados}" />
                            <h:outputText value="#{relatorioWebServiceController.estacoesPLU}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_pontosMonitoramentoTransm}" />
                            <h:outputText value="#{relatorioWebServiceController.pontosComDados}"/>


                        </h:panelGrid>                            
                    </p:panel> 

                    <p:panel id="panelInformativoGeral" header="#{bundle.ListWebserviceTitle_quantitativoGeral}" style="width: 400px">
                        <h:panelGrid columns="2" >

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_empresasAtivas}" />
                            <h:outputText value="#{relatorioWebServiceController.qtdEmpresasAtivas}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_empresasOperandoWebservice}" />
                            <h:outputText value="#{relatorioWebServiceController.qtdEmpresasOperandoWebServiceGeral}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_estacoesFLU}" />
                            <h:outputText value="#{relatorioWebServiceController.estacoesGeralFLU}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_estacoesPLU}" />
                            <h:outputText value="#{relatorioWebServiceController.estacoesGeralPLU}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_pontosComDados}" />
                            <h:outputText value="#{relatorioWebServiceController.pontosComDadosGeral}"/>

                            <h:outputLabel value="#{bundle.ListWebserviceTitle_pontosRelacionados}" />
                            <h:outputText value="#{relatorioWebServiceController.qtdPontosRelacionados}"/>                             

                        </h:panelGrid>                            
                    </p:panel> 
                </h:panelGrid>
            </p:panel>


        </ui:define>
    </ui:composition>

</html>
